//folder.js
import request from '@/utils/request'

//移动 前置请求-获取所有目录结构
export function getTreeDirectory() {
  return request({
    url: '/video-distribute/folders/list',
    method: 'get'
  })
}
//===================文件=====================

//查询文件表 和文件夹 一起查询
export function queryFileList(query) {
  return request({
    url: '/video-distribute/files/folder/list',
    method: 'get',
    params: query
  })
}

//===================文件夹=====================


//新建公共文件夹
export function createPublicFolder(data) {
  return request({
    url: '/video-distribute/folders/add',
    method: 'post',
    data: data
  })
}


//重命名文件夹
export function renameFolder(data) {
  return request({
    url: '/video-distribute/folders/rename/'+ data.folderId+"/"+ data.folderName +"/"+ data.type,
    method: 'get',
  })
}
//删除文件夹
export function deleteFolder(data) {
  return request({
    url: '/video-distribute/folders/' + data.folderId + "/"+data.type,
    method: 'delete'
  })
}
//移动文件夹
export function moveFolder(data) {
  return request({
    url: '/video-distribute/folder',
    method: 'put',
    data: data
  })
}


//删除文件
export function deleteFile(fileId) {
  return request({
    url: '/video-distribute/file/' + fileId,
    method: 'delete'
  })
}

//移动文件夹
export function moveFile(data) {
  return request({
    url: '/video-distribute/file',
    method: 'put',
    data: data
  })
}


/*
*  查询目录下的子文件，
*
* 返回 绑定的所有文件。
* */
export function getVideosFromFolderAndFile(data) {
  return request({
    url: '/video-distribute/files/searchAll/list',
    method: 'post',
    data: data
  })
}
